package com.acc.sys.controller;

import com.acc.sys.framework.AccParser;
import com.acc.sys.service.UploadService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/sys/common")
@AllArgsConstructor
public class CommonController {
    private UploadService uploadService;

    /**
     * 文件上传
     *
     * @param file 文件
     * @return 文件上传
     */
    @RequestMapping("/upload")
    public String upload(MultipartFile file) {
        return AccParser.extendSuccessResult(uploadService.upload(file)).toJSONString();
    }

}
